package com_1;

import java.util.TreeSet;

public class StudentDemo {
    public static void main(String[] args) {
        TreeSet<Student> t = new TreeSet<>();
        Student s1 = new Student("小红", 18);
        Student s2 = new Student("小李", 20);
        Student s3 = new Student("小王", 21);
        Student s5 = new Student("小白", 21);
        t.add(s1);
        t.add(s2);
        t.add(s3);
        t.add(s5);
        for (Student s4 : t) {
            System.out.println(s4.getName() + s4.getAge());
        }
    }
}
